package com.my.study.utils;

import com.my.study.exception.BusinessException;
import com.my.study.enums.BusinessExceptionEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.Properties;

@Slf4j
public class PropertiesUtil {

    public static Properties readProperties(String fileName) {
        Properties properties = new Properties();
        try {
            properties.load(PropertiesUtil.class.getClassLoader().getResourceAsStream(fileName));
        } catch (Exception exception) {
            log.error("properties read failed" + exception);
            throw BusinessException.fail(BusinessExceptionEnum.FAIL.code, "properties文件读取失败");
        }
        return properties;
    }
}
